Racing Game


About

One day I looked into the mirror and thought "dude, you never created a racing game before!", and that's when I began my research to know how others do it. Bored of the usual tutorials and material I had found on the internet that wouldn't satisfy me, I decided to go blindfolded into this project, creating what I thought was right. Since I didn't have the time to make something realistic like a race sim, I took Mario-Kart as a reference: it's a cartoonish and unrealistic racing game. I got my inspiration mostly from that game, which had brought me to create a "combo ability" system where you must collect 2 abilities of the same type to activate it. You can see this game mechanic in action in the GIF, where the speed bost and rocket abilities are illustrated.

Technical Aspects

I wanted to make an AI that would control the exact same vehicle structure as the player, but make it adapt to all scenarios; this meant that I couldn't add anything in the racetrack that would tell the AI where to go next. I copied the player's Character Controller script I've coded prior to creating the AI and just removed the keyboard inputs, exposing the accelleration and steering variables and called the script "Vehicle". Afterwards, I created a "Vehicle AI" script that behaves like an artificial pilot that detects its surroundings through raycasting. In the animated gif you can see that there are different raycasts, useful for obtaining information about the road that's next to them, the distance between the vehicle and the next curve, the width of the curve and the angle of it; all of this information then ties together to get the most optimal approach to drive flawlessly without slowing down or accellerating too much.

The future of this project

As of now, I don't know what this project will turn into. It might become something official as it might stay in this state. I've created this for fun, and it also served me as a decent learning experience since I challenged myself to make something I've never attempted before using mostly placeholder assets created by me.